Side panel
Enables focused interaction with specific tasks or information without losing sight of the main content.
#Examples
SidePanel
is a a container element that overlays the main content area, typically anchored to the right side of the screen. It is designed to provide additional context, tools, or actions related to the current view. It includes a header with a close button, the main content area, and an optional footer. The Side Panel consists of:
- Container: The overall panel structure.
- Header:
- Title with optional tooltip for clarity
- Clear close button for immediate dismissal
- Content area: Flexible space for the panel's main purpose (forms, details, etc.).
- Footer (optional): Fixed area for actions.
#Default
Use Cases: Displaying forms, detailed information, or configuration options.
Best Practices:
- Side panels should enhance, not interrupt, the main experience.
- Keep some of the main page content visible for context.
const [showSidePanel, setShowSidePanel] = useState(false);
return (
<>
<Button aria-haspopup="dialog" onClick={() => setShowSidePanel(true)}>
Trigger side panel
</Button>
<SidePanel
shown={showSidePanel}
headerTitle="Header text"
onClose={() => setShowSidePanel(false)}
>
<Content>
<Paragraph>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro nemo repellendus
obcaecati praesentium illo, voluptate fugiat quisquam vitae nostrum modi earum eos
nesciunt at, placeat sint vel quas quae aliquid.
</Paragraph>
</Content>
</SidePanel>
</>
);
#Header with tooltip
Adds a tooltip to the header title for additional context or instructions.
Use Cases: When the header title needs clarification.
Best Practices:
- To add a tooltip to the header you must use the
headerTitleTooltipText
prop to ensure proper accessibility. Do not add the Tooltip component to theheaderTitle
prop. - If you need to change the placement of the tooltip you can use the
headerTitleTooltipPlacement
prop.
const [showSidePanel, setShowSidePanel] = useState(false);
return (
<>
<Button aria-haspopup="dialog" onClick={() => setShowSidePanel(true)}>
Trigger side panel
</Button>
<SidePanel
shown={showSidePanel}
headerTitle="Header text with tooltip"
headerTitleTooltipText="Lorem ipsum dolor sit amet consectetur adipisicing elit."
headerTitleTooltipPlacement="bottom"
onClose={() => setShowSidePanel(false)}
>
<Content>
<Paragraph>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro nemo repellendus
obcaecati praesentium illo, voluptate fugiat quisquam vitae nostrum modi earum eos
nesciunt at, placeat sint vel quas quae aliquid.
</Paragraph>
</Content>
</SidePanel>
</>
);
#Footer
Includes a sticky footer within a Side panel, often used for action buttons.
Use Cases: Presenting actions (e.g., "Save," "Cancel") to confirm choices, submit information, or navigate steps.
Best Practices:
- Side panels can optionally contain a (sticky) footer. This section is intended for information and actions that relate to the
SidePanel
as a whole. In most cases, that will be the Action Bar component, which provides users with a set of actions related to the completion of a task. - Add a footer by placing a
SidePanel.Footer
component inside aSidePanel
as its last child.
const [showSidePanel, setShowSidePanel] = useState(false);
return (
<>
<Button aria-haspopup="dialog" onClick={() => setShowSidePanel(true)}>
Trigger side panel
</Button>
<SidePanel
shown={showSidePanel}
headerTitle="Header text"
onClose={() => setShowSidePanel(false)}
>
<Content>
<Paragraph>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro nemo repellendus
obcaecati praesentium illo, voluptate fugiat quisquam vitae nostrum modi earum eos
nesciunt at, placeat sint vel quas quae aliquid.
</Paragraph>
</Content>
<SidePanel.Footer>
<ActionBar
primary={{ children: "Confirm", onClick: () => setShowSidePanel(false) }}
cancel={{ children: "Cancel", onClick: () => setShowSidePanel(false) }}
/>
</SidePanel.Footer>
</SidePanel>
</>
);
#Dropzone
Controls where the SidePanel
is rendered in the DOM.
Use Cases: When you need control over the SidePanel
's placement within the page structure.
Best Practices:
- By default, side-panel is appended to the DOM in the bottom of <body>.
DialogDropzone
lets you to control where in the DOM the side-panel is rendered, allowing it to inherit styles, if you don't use a global stylesheet.
<DialogDropzone />
#Properties
Property | Description | Defined | Value |
---|---|---|---|
shownRequired | boolean Indicates whether the side panel is shown or not | ||
onCloseRequired | function Callback for when the close button is clicked | ||
childrenOptional | element Content of the side panel | ||
onUnmountOptional | function Callback for when the side panel is unmounted | ||
classNameOptional | string Custom className that's applied to the outermost element (only intended for special cases) | ||
styleOptional | object Style object to apply custom inline styles (only intended for special cases) | ||
headerTitleOptional | element | ||
headerTitleTooltipTextOptional | | string | number | element | ||
headerTitleTooltipPlacementOptional | "bottom" | "bottom-end" | "bottom-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start" | ||
idOptional | string | ||
headerIconOptional | element | ||
hideCloseOptional | boolean | ||
data-observe-keyOptional | string Unique string, used by external script e.g. for event tracking |
#Guidelines
#Best practices
#Do not use when
#Accessibility
Explore detailed guidelines for this component: Accessibility Specifications